package com.lz.autotest.project.testmanage.reportmanage.controller;

import com.lz.autotest.common.aspectj.lang.annotation.Log;
import com.lz.autotest.common.aspectj.lang.enums.BusinessType;
import com.lz.autotest.common.web.controller.BaseController;
import com.lz.autotest.common.web.domain.AjaxResult;
import com.lz.autotest.common.web.page.TableDataInfo;
import com.lz.autotest.project.testmanage.reportmanage.domain.SstInfReport;
import com.lz.autotest.project.testmanage.reportmanage.service.IReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 参数配置 信息操作处理
 *
 * @author lz
 */
@RestController
@RequestMapping("/report")
public class ReportController extends BaseController {
    @Autowired
    private IReportService reportService;

    /**
     * 获取参数配置列表
     */
    @PreAuthorize("@ss.hasPermi('testmanage:report:list')")
    @GetMapping("/list")
    public TableDataInfo list(SstInfReport sstInfReport) {
        startPage();
        List<SstInfReport> list = reportService.selectReportList(sstInfReport);
        return getDataTable(list);
    }

    /**
     * 根据参数键名查询参数值
     */
    @GetMapping(value = "/ReortId/{reportId}")
    public AjaxResult selectRepoprtById(@PathVariable SstInfReport sstInfReport) {
        return AjaxResult.success(reportService.selectReportById(sstInfReport));
    }

    /**
     * 删除参数配置
     */
    @PreAuthorize("@ss.hasPermi('testmanage:report:remove')")
    @Log(title = "参数管理", businessType = BusinessType.DELETE)
    @DeleteMapping("/{reportIds}")
    public AjaxResult remove(@PathVariable Long[] reportIds) {
        reportService.deleteReportByIds(reportIds);
        return success();
    }

}
